package com.wedimob.slideshare.bo;

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import com.wedimob.slideshare.parser.annotation.Factory;
import com.wedimob.slideshare.parser.annotation.HTMLMapping;
import com.wedimob.slideshare.parser.annotation.DocMappings;
import com.wedimob.slideshare.source.ScribdStrategy;
import com.wedimob.slideshare.source.SlideShareStrategy;
import com.wedimob.slideshare.source.YoutubeStrategy;

@DocMappings(
        html =
        {
                @HTMLMapping(url = SlideShareStrategy.SEARCH_PATTERN, tag = "li.clearfix"),
                @HTMLMapping(url = SlideShareStrategy.USER_DOC_PAGE_PATTERN, tag = "a[data-hits]"),
                @HTMLMapping(url = YoutubeStrategy.SEARCH_PATTERN, tag = "li.clearfix"),
                @HTMLMapping(url = ScribdStrategy.SEARCH_PATTERN, tag = "div.autogen_class_views_solr_result_document"),
        })
public class Summaries extends Container<Summary> {

    /**
	 * 
	 */
    private static final long serialVersionUID = 8624135865760879957L;

    public static void main(String[] args) throws IOException {
    	//String url0 = "http://fr.slideshare.net/search/slideshow?searchfrom=header&q=pyramide";
    	//String url1 = "http://fr.scribd.com/search?language=&limit=10&num_pages=&page=2&query=test";
    	String url2 = "http://www.youtube.com/results?search_query=test&search_type=videos&search_sort=video_date_uploaded";
        Document doc = Jsoup.connect(url2)
        		.userAgent("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.21 (KHTML, like Gecko) Chrome/19.0.1042.0 Safari/535.21")
                .timeout(60000).get();
        Summaries summaries = Factory.fromDocument(doc, Summaries.class, null);
        System.out.println(summaries);
    }
}
